<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$tabs=array(
	array('op'=>'basic','title'=>'赠送设置'),
);
set_html('tabs',$tabs);
$return['credit_types']=credit_types();
foreach($return['credit_types'] as $k=>$cv){
	if($k==2){
		unset($return['credit_types'][$k]);
	}
}
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$post=get_postdata();
		$this->plugin_setting('buy_credit3',$post);
		exi('设置成功');
	}
	$item=$this->plugin_setting('buy_credit3');
	$return['item']=$item;
	$htmls=array(
		'type'=>'edit',
		'desc'=>'虚拟币赠送',
		'edit'=>array(
			array('type'=>'tip','title'=>'<red>【不生效？】商城--营销--购物送虚拟币，必须设置开启好，才生效！</red><red>优先生效，商户的币赠送，其次才生效：商城--运营--积分/币赠送相关设置</red>','help'=>''),
			array('type'=>'switch','name'=>'open','title'=>'是否启用','help'=>''),
			array('type'=>'switch','name'=>'is_codepay','title'=>'是否收款码付款也送积分？','help'=>''),
			array('type'=>'tip','title'=>'温馨提示：<red>获得积分小于1，将失效，只有大于1个以上的积分，才会赠送积分！</red>','help'=>''),
			array('type'=>'array_string_much','name'=>'options','title'=>'虚拟币赠送机制','fields'=>array(
				array('title'=>'购物'),
				array('name'=>'start'),
				array('title'=>'元至'),
				array('name'=>'end'),
				array('title'=>'元|每消费1元赠送'),
				array('name'=>'credit'),
				array('type'=>'radio','demotitle'=>'币类型','name'=>'type','options'=>'credit_types'),
			)),
		)
	);
	$return['paytypes']=array('1'=>'微信支付','2'=>'余额支付','3'=>'支付宝支付');
	$return['times']=array(
		'pay'=>'支付完毕时',
		'complete'=>'订单完成时',
	);
	$return['types']=array(
		'1'=>'根据订单金额赠送虚拟币',
		'2'=>'根据商品赠送虚拟币',
	);
	$return['htmls']=$htmls;	
	exi($return);
}